import matplotlib.pyplot as plt
import numpy as np
from matplotlib.lines import lineStyles
from matplotlib.pyplot import figure

plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False

#创建数据
x = np.linspace(0, 10, 100)
y1 = np.sin(x)
y2 = np.cos(x)

#创建图表
plt.figure(figsize=(10, 6))
#绘制折现
plt.plot(x, y1, label="sin(x)", color = 'blue',linewidth = 2, linestyle='-')
plt.plot(x, y2, label="cos(x)", color = '#F00',linewidth = 2, linestyle='--')

plt.title('折线图示例')
plt.xlabel('X轴')
plt.ylabel('Y轴')
plt.legend()
plt.grid(True, linestyle='-.', alpha = 0.2)
plt.show()